m, n = map(int, input().split())
matrix = []
for i in range(m):
    line = list(map(int,input().split()))
    matrix.append(line)
target = int(input())
res = 'false'
def mid_find(arr, t):
    l, r = 0, len(arr)-1
    mid = 0
    while l < r:
        mid = (l+r)//2
        if arr[mid] < t:
            l = mid + 1
        elif arr[mid] > t:
            r = mid - 1
        else:
            return mid
    return l
m0 = [x[0] for x in matrix]
col = mid_find(m0, target)
cols = [col]
while col > 0:
    if m0[col] == m0[col-1]:
        cols.append(col-1)
        col = col-1
    else:
        break

for c in cols[::-1]:
    r = mid_find(matrix[c], target)
    if matrix[c][r] == target:
        res = 'true'
        break
print(res)
